package chapter_20


class Food
abstract class Animal {
  type SuitableFood <: Food // 上界
  def eat(food: SuitableFood)
}


class Grass extends Food
class Cow extends Animal {
  override type SuitableFood = Grass
  def eat(food: Grass): Unit = {
    println("用草喂牛")
  }
}


object FoodAndCow {

}
